meson: use correct module file extension on macOS
authorDavid Lechner <david@lechnology.com>
Fri, 5 Feb 2021 21:56:14 +0000 (15:56 -0600)
committerDavid Lechner <david@lechnology.com>
Fri, 5 Feb 2021 22:54:28 +0000 (16:54 -0600)
GModule requires the .so file extension on macOS for historic reasons.
However Meson defaults to .dylib for modules, so we need to override
it to get the correct extension.

Fixes #3645.

meson.build
modules/media/meson.build
modules/printbackends/meson.build

index d13408bf952c4b472954169b20fee70f66e76d31..729aa3ea193d5a985c09cf95d96dcdb483e10688 100644 (file)
@@ -85,6 +85,13 @@ gtk_library_version = '1.@0@.@1@'.format(gtk_binary_age - gtk_interface_age, gtk
 
 gtk_api_version = '4.0'
 
+module_suffix = []
+# GModule requires file extension to be .so, not .dylib on Mac.
+# https://gitlab.gnome.org/GNOME/glib/issues/520
+if ['darwin', 'ios'].contains(host_machine.system())
+  module_suffix = 'so'
+endif
+
 x11_enabled      = get_option('x11-backend')
 wayland_enabled  = get_option('wayland-backend')
 broadway_enabled = get_option('broadway-backend')
index aa5c0280e65c6a6f312f7f7556dff9e6b6136dee..154390e7fec8eb85278fe69e9e9975fbe257b40b 100644 (file)
@@ -35,6 +35,7 @@ if ffmpeg_found
     sources: 'gtkffmediafile.c',
     c_args: extra_c_args,
     dependencies: [ libgtk_dep, ffmpeg_deps ],
+    name_suffix: module_suffix,
     install_dir: media_install_dir,
     install: true,
   )
@@ -56,6 +57,7 @@ if gstplayer_dep.found() and gstgl_dep.found()
     ],
     c_args: extra_c_args,
     dependencies: [ libm, libgtk_dep, gstplayer_dep, gstgl_dep ],
+    name_suffix: module_suffix,
     install_dir: media_install_dir,
     install: true,
   )
index 64d8a41974c7255e7b112d84b7f489cdf814800e..fa55d60e3b81dd364cddb7c29202116720eece7a 100644 (file)
@@ -22,6 +22,7 @@ if cups_dep.found()
     ],
     c_args: printbackends_args,
     dependencies: [libgtk_dep, cups_dep, colord_dep],
+    name_suffix: module_suffix,
     install_dir: printbackends_install_dir,
     install: true,
   )
@@ -32,6 +33,7 @@ else
     sources: 'gtkprintbackendlpr.c',
     c_args: printbackends_args,
     dependencies: libgtk_dep,
+    name_suffix: module_suffix,
     install_dir: printbackends_install_dir,
     install: true,
   )
@@ -49,6 +51,7 @@ if rest_dep.found() and json_glib_dep.found()
     ],
     c_args: printbackends_args,
     dependencies: [ libgtk_dep, rest_dep, json_glib_dep ],
+    name_suffix: module_suffix,
     install_dir: printbackends_install_dir,
     install: true)
 endif
@@ -59,6 +62,7 @@ shared_module('printbackend-file',
   sources: 'gtkprintbackendfile.c',
   c_args: printbackends_args,
   dependencies: libgtk_dep,
+  name_suffix: module_suffix,
   install_dir: printbackends_install_dir,
   install: true,
 )